package com.stu.chart.util;

import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.User;

/**
 * @author dsj
 */
public class SecurityUtil {

    public static User getUser(){
        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        User user = null;
        try {
            user = (User) authentication.getPrincipal();
        }catch (Exception e){}
        return user;
    }
}
